package cn.com.hhrcw.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.apache.commons.lang3.StringUtils;
import org.jeecgframework.poi.excel.annotation.Excel;

import java.io.Serializable;
import java.util.Date;

/**
 * @Description: 系统日志表
 * @Author: jiangdong
 * @Date: 2020-11-13
 * @Version: V1.0
 */
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value = "sys_log响应结果", description = "系统日志表")
public class SysLogVO implements Serializable {


    /**
     *
     */
    private String id;


    /**
     * 日志类型（1登录日志，2操作日志）
     */
    @ApiModelProperty(value = "日志类型（1登录日志，2操作日志）")
    @Excel(name = "日志类型（1登录日志，2操作日志）")
    private Integer logType;


    /**
     * 日志内容
     */
    @ApiModelProperty(value = "日志内容")
    @Excel(name = "日志内容")
    private String logContent;


    /**
     * 操作类型
     */
    @ApiModelProperty(value = "操作类型")
    @Excel(name = "操作类型")
    private Integer operateType;


    /**
     * 操作用户账号
     */
    @ApiModelProperty(value = "操作用户账号")
    @Excel(name = "操作用户账号")
    private String userid;


    /**
     * 操作用户名称
     */
    @ApiModelProperty(value = "操作用户名称")
    @Excel(name = "操作用户名称")
    private String username;


    /**
     * IP
     */
    @ApiModelProperty(value = "IP")
    @Excel(name = "IP")
    private String ip;


    /**
     * 请求java方法
     */
    @ApiModelProperty(value = "请求java方法")
    @Excel(name = "请求java方法")
    private String method;


    /**
     * 请求路径
     */
    @ApiModelProperty(value = "请求路径")
    @Excel(name = "请求路径")
    private String requestUrl;


    /**
     * 请求参数
     */
    @ApiModelProperty(value = "请求参数")
    @Excel(name = "请求参数")
    private String requestParam;


    /**
     * 请求类型
     */
    @ApiModelProperty(value = "请求类型")
    @Excel(name = "请求类型")
    private String requestType;


    /**
     * 耗时
     */
    @ApiModelProperty(value = "耗时")
    @Excel(name = "耗时")
    private Long costTime;


    /**
     * 创建人
     */
    @ApiModelProperty(value = "创建人")
    @Excel(name = "创建人")
    private String createBy;


    /**
     * 创建时间
     */
    @ApiModelProperty(value = "创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Excel(name = "创建时间", format = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;


    /**
     * 更新人
     */
    @ApiModelProperty(value = "更新人")
    @Excel(name = "更新人")
    private String updateBy;


    /**
     * 更新时间
     */
    @ApiModelProperty(value = "更新时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Excel(name = "更新时间", format = "yyyy-MM-dd HH:mm:ss")
    private Date updateTime;

    @Override
    public boolean equals(Object anObject) {
        if (anObject == null) {
            return false;
        }
        if (this == anObject) {
            return true;
        }
        if (anObject instanceof SysLogVO) {
            SysLogVO another = (SysLogVO) anObject;
            return StringUtils.isNotBlank((another).getUserid()) &&
                StringUtils.isNotBlank(this.getUserid()) && another.getUserid().equals(this.getUserid());
        }
        return false;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + logType;
        result = prime * result + ((userid == null) ? 0 : userid.hashCode());
        return result;
    }

}
